package edu.ntu.im.p2ptrade.msg.handle;

import net.jxta.endpoint.Message;
import edu.ntu.im.p2ptrade.P2PTrade;
import edu.ntu.im.p2ptrade.Util;
import edu.ntu.im.p2ptrade.msg.AuthenticatedMessageWrapper;
import edu.ntu.im.p2ptrade.msg.MyItems;
import edu.ntu.im.p2ptrade.msg.PMessage;

public class QueryItemHandle implements PMessageHandle{

	public void handle(Message msg) {
		String peer = msg.getMessageElement(P2PTrade.getInstance().getAppName(), PMessage.PEER).toString();
		PMessage myItems  = new AuthenticatedMessageWrapper(new MyItems());
		try {
			Util.transdferMessageToPeer(myItems.getMessageToTransfer(), peer);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	

}
